package com.gpzx.zx.module.home.frame.presenter

import com.gpzx.zx.module.home.frame.model.InfomationInfo
import com.wkq.base.frame.mosby.MvpBasePresenter
import com.gpzx.zx.module.home.frame.view.InfoWebView
import com.gpzx.zx.module.home.ui.activity.InfoWebViewActivity
import com.gpzx.zx.utlis.DBUtlis
import com.gpzx.zx.utlis.QklDbUtlis

/**
 *
 * 作者:吴奎庆
 *
 * 时间:2020/6/12
 *
 * 用途:
 */


class InfoWebPresenter : MvpBasePresenter<InfoWebView>() {


    fun getData(infoWebViewActivity: InfoWebViewActivity, type: String?, index: String?) {

        if ("qkl_author_news".equals(type)) {
            var db = QklDbUtlis(infoWebViewActivity)
            var topNew = db.getAuthorNewsByID(index)
            if (topNew != null) view.showView(topNew!!.news_icon, topNew!!.news_detail, topNew!!.news_title, topNew!!.news_author_name, topNew!!.news_author_icon, topNew!!.news_author_desc, topNew!!.id, topNew!!.news_id, topNew!!.news_type)
        } else if ("qkl_gp_top".equals(type)) {
            var db = QklDbUtlis(infoWebViewActivity)
            var topNew = db.getNewsDetail(index)
            if (topNew != null) view.showView(topNew!!.news_icon, topNew!!.news_detail, topNew!!.news_title, topNew!!.news_author_name, topNew!!.news_author_icon, topNew!!.news_author_desc, topNew!!.id, topNew!!.news_id, topNew!!.news_type)

        } else if ("qkl_news".equals(type)) {
            var db = QklDbUtlis(infoWebViewActivity)
            var topNew = db.getNewsDetail(index)
            if (topNew != null) view.showView(topNew!!.news_icon, topNew!!.news_detail, topNew!!.news_title, topNew!!.news_author_name, topNew!!.news_author_icon, topNew!!.news_author_desc, topNew!!.id, topNew!!.news_id, topNew!!.news_type)
        }
    }
}